﻿using System;
using System.Collections.Generic;
using System.Data.Entity.Infrastructure;
using System.Globalization;
using CodeFirstEntityConfiguration.Models;

namespace CodeFirstEntityConfiguration.Infrastructure
{
    public class PostDbInitializer : RecreateDatabaseIfModelChanges<PostDb>
    {
        protected override void Seed(PostDb postDb)
        {
            var posts = new List<Post>
                            {
                                new Post{
                                    Title = @"Battle: Los Angeles Mixes UFO Lore, Fallujah Feel",
                                    Body = "SAN DIEGO — Graft urban combat’s raw intensity and a back story based on"+ 
                                            "real events onto an explosive alien invasion and you’ve got Battle: Los Angeles,",
                                    CreatedBy = "Bikal Gurung", 
                                    CreatedOn = DateTime.Parse("15/01/2010", new CultureInfo("en-GB"))
                                },

                                new Post{
                                    Title = @"Tron: Legacy Takes Comic-Con Back to Belly of the Technobeast", 
                                    Body="SAN DIEGO — Unlike a buggy piece of software, nobody rushed Tron:" + 
                                           "Legacy to market. It looks like perfect timing for version 2.0 of the sci-fi movie:", 
                                    CreatedBy = "Bikal Gurung", 
                                    CreatedOn = DateTime.Parse("20/02/2010", new CultureInfo("en-GB"))
                                }
                            };
            posts.ForEach(post => postDb.Posts.Add(post));
        }
    }
}